home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-12 | 2.6 KB | 73 lines | [TEXT/MPS ] |
- # Macintosh Programmer’s Toolbox Assistant
- # Copyright © 1986-1995 Apple Computer, Inc. All rights reserved.
- #
- # -- brain surgery provided by the MPW doctors, 1/12/95
- #
- # ------------------------------- #
- # MPTA_MPWAccess
- # ------------------------------- #
- #
- # Put this file in the MPW Scripts folder.
- #
- # This MPW script allows you to access the Macintosh Programmer’s Toolbox Assistant
- # Apple Event commands from the MPW shell. It depends upon the {MPTA_Location} and
- # {MPTA_AppName} variables being defined and the MPTA menu being added by the
- # UserStartup•MPTA script. It also depends upon the existence of the SendAE tool in
- # the MPW Tools folder.
- #
- # {1} = name of the Macintosh Programmer’s Toolbox Assistant command to execute
- #
-
- set thisMPTA_AECommand "{1}"
-
- unset thisSelectedTerm # initialize
-
- If "`Catenate "{Active}.§"`" == ""
- set exit 0
- find \[¬{wordset}]\Δ:Δ/[¬{wordset}]/ "{Active}" # select the current word
- if "{status}" ≠ 0
- if `position -l "{Active}"` == 1 # first word in file?
- find •:/[{wordset}]+/ "{Active}" # yes, select it
- else # else must be word at end of file
- find \[¬{wordset}]\Δ:∞ "{Active}" # select the current word
- end
- end
- end
- set thisSelectedTerm "`Catenate "{Active}.§"`" # remember the current selection
-
- # The following code checks the MPW Shell version number to see
- # if we can use the -background option when launching an
- # application. (We can for versions 3.4 and later.). We want to
- # launch QuickView into the background when retrieving template
- # information so that the MPW Shell will remain in the foreground.
- #
- (evaluate "`version`" =~ /≈([0-9]+)®1.([0-9]+)®2≈/) ∑dev:null
- if "{®1}{®2}" >= 34
- set MPTA_Options "-background"
- else
- set MPTA_Options ""
- end
-
- If "{thisMPTA_AECommand}" == "Lookup"
- set exit 0
- (SendAE -e "DanRREF " -t "{MPTA_AppName}" -----TEXT "{thisSelectedTerm}") ≥ "{TempFolder}"errorInfo
- if "`catenate "{TempFolder}"errorInfo`" != ""
- "{MPTA_Location}"
- SendAE -e "DanRREF " -t "{MPTA_AppName}" -----TEXT "{thisSelectedTerm}"|| Beep
- end ∑∑"{Worksheet}"
- else if "{thisMPTA_AECommand}" == "GetTemplate"
- set exit 0
- set tmpl "`(SendAE -e "DanRTMPL" -t "{MPTA_AppName}" -dot -----TEXT "{thisSelectedTerm}") ≥ "{TempFolder}"errorInfo`"
- if "`catenate "{TempFolder}"errorInfo`" != ""
- "{MPTA_Location}" {MPTA_Options}
- Set tmpl "`SendAE -e "DanRTMPL" -t "{MPTA_AppName}" -dot -----TEXT "{thisSelectedTerm}" || Beep`"
- end ∑∑"{Worksheet}"
- if "{tmpl}" != ""
- echo "{tmpl}" >"{Active}".§
- End
- else
- Alert "Macintosh Programmer’s Toolbox Assistant error: ∂n∂n “unrecognized command”"
- end
-
- delete -i -y "{TempFolder}"errorInfo ∑dev:null
-